﻿using System;
using System.Numerics;

namespace DapperLambdaSQL.Utils
{
    public static class ReflectionUtility
    {
        /// <summary>
        /// 判断是否是值类型
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static bool IsValueType<T>()
        {
            var type = typeof(T);
            return type.IsValueType;
        }

        /// <summary>
        /// 判断是否是值类型
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static bool IsBoolean<T>(T value)
        {
            return value is Boolean;
        }

        public static bool IsInteger(ValueType value)
        {
            return (value is SByte || value is Int16 || value is Int32
                    || value is Int64 || value is Byte || value is UInt16
                    || value is UInt32 || value is UInt64
                    || value is BigInteger);
        }
    }
}